Calling "Insert OLE object..." from my personnal button

Hi

I would like to create my own form with a richText element and a button that will call the same "Insert OLE object..." function as provided in the module menu.

I edited my Object Text and I called the callStdItem_(OLEInsertItem) function but I have the following error :

-R-E- DXL: <Line:5> Standard menu item OLEInsertItem is unavailable
-I- DXL: execution halted

Does anyone know how I could call this function from my personnal button ?

Thanks and regards

David
SystemAdmin - Mon Jul 18 11:30:44 EDT 2011

Re: Calling "Insert OLE object..." from my personnal button
Mathias Mamsch - Tue Jul 19 05:32:08 EDT 2011

The problem that you have, is that you would need to enter inplace editing mode on the object text attribute before you can insert an OLE object (that is why you get the menu is unavailable message). Unfortunately I found no perm that would let you enter inplace editing for an attribute, so your only option might be, to restrict your menu to certain objects like: Insert Excel Object, Insert Word Object, ... . Then you could insert the object in some test module manually and get the compressed richText using:
 

string sResult = ""
toCompressedBase64_ (richTextWithOle (current Object)."Object Text", sResult)
print sResult
// This yields for my computer some pretty large string: 
// f1LDkRbAedp//lYtBXl7OTb470VbQWcp/3JY9FWlPPl ....... ElhnMS

Then you take this string, embed it into some DXL include file like:

// replace that string by the complete string above ...
string sgOleDataExcel  = "eJztXEmv3LgRvj+g/4PPOQTctCHn ........ ElhnMS"
string res = null
print fromCompressedBase64_ (sgOleDataExcel, res)
(current Object)."Object Text" = richText res


The smart thing about that approach is, that you could also prefill the objects with a default, e.g. put default values in an Excel Worksheet, resize it to show the correct amount of columns/rows, or even have different Excel Tables to insert. Just edit the object to your likes before getting the richText from it.

Note: I use the compressedBase64 functions for ease of copy/pasting (no escaping necessary) and to simply save space. If you are worried about performance, you should use Buffers and probably store the richText to a file and read it from there.

Hope that helps, Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS